const express = require('express')
const router = express.Router()

const news_handler = require('../router_handler/news')
const expressJoi = require('@escook/express-joi')
const {add_news_schema,
       delete_news_schema,
       get_news_schema
    } = require('../schema/news')

// 展示新闻列表
router.get('/newslist',news_handler.getNewsList)
// 添加新闻
router.post('/add',news_handler.addNews)
// 删除新闻
router.get('/delete/:newsId',expressJoi(delete_news_schema),news_handler.deleteNews)
// 修改新闻
router.post('/update',news_handler.updateNewsById)
// 查询新闻
router.get('/newslist/:newsTitle',news_handler.getNewsById)
// 根据新闻名称查询新闻
module.exports = router